{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#  LaTeX Mathematics and MathJax\n",
    "\n",
    "[LaTex](http://www.latex-project.org/) : A document preparation system\n",
    "\n",
    "LaTeX is a high-quality typesetting system; it includes features designed for the production of `technical and scientific documentation`.\n",
    "\n",
    "Typesetting mathematics is one of LaTeX's greatest strengths.\n",
    "\n",
    "**MathJax**\n",
    "\n",
    "[MathJax](https://www.mathjax.org/):Beautiful math in all browsers \n",
    "\n",
    "A **JavaScript display engine** for mathematics that works in all browsers. \n",
    "\n",
    "Jupyter Notebook中Markdown单元中的LaTeX数学公式使用**MathJax**来显示。\n",
    "\n",
    "## 1 插入公式\n",
    "\n",
    "[LaTex](http://www.latex-project.org/)数学公式有两种：行中公式和独立公式。\n",
    "\n",
    "* **行中公式**  放在文中与其它文字混编。 Inline (within text) formulas\n",
    "\n",
    "* **独立公式** 单独成行。Displayed equations\n",
    "\n",
    "### 1.1 行中公式\n",
    "\n",
    "`$数学公式$`\n",
    "\n",
    "例如：\n",
    "```bash\n",
    "   我们定义:$f(x) = \\sum_{i=0}^{N}\\int_{a}^{b} g(t,i) \\text{ d}t$.\n",
    "```\n",
    "\n",
    "我们定义:$f(x) = \\sum_{i=0}^{N}\\int_{a}^{b} g(t,i) \\text{ d}t$.\n",
    "\n",
    "### 1.2 行公式\n",
    "\n",
    "`$$数学公式$$`\n",
    "\n",
    "例如：\n",
    "```\n",
    "$$J_\\alpha(x) = \\sum_{m=0}^\\infty \\frac{(-1)^m}{m! \\Gamma (m + \\alpha + 1)} {\\left({ \\frac{x}{2} }\\right)}^{2m + \\alpha}$$\n",
    "```\n",
    "公式行中显示：\n",
    "\n",
    "$$J_\\alpha(x) = \\sum_{m=0}^\\infty \\frac{(-1)^m}{m! \\Gamma (m + \\alpha + 1)} {\\left({ \\frac{x}{2} }\\right)}^{2m + \\alpha}$$\n",
    "\n",
    "\n",
    "如果： \n",
    "```\n",
    "$J_\\alpha(x) = \\sum_{m=0}^\\infty \\frac{(-1)^m}{m! \\Gamma (m + \\alpha + 1)} {\\left({ \\frac{x}{2} }\\right)}^{2m + \\alpha}$\n",
    "```\n",
    "是只有公式的行，但仍是行内公式，因此，公式行左显示：\n",
    "\n",
    "$J_\\alpha(x) = \\sum_{m=0}^\\infty \\frac{(-1)^m}{m! \\Gamma (m + \\alpha + 1)} {\\left({ \\frac{x}{2} }\\right)}^{2m + \\alpha}$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1.3 多行公式对齐\n",
    "\n",
    "```txt\n",
    "$$\\begin{align*}\n",
    "  &\\frac{dS}{dt}=-\\frac{\\beta SI}{N}\\\\\n",
    "  &\\frac{dI}{dt}=\\frac{\\beta SI}{N}-\\gamma \\\\\n",
    "  &\\frac{dR}{dt}=\\frac{\\gamma}{I} \n",
    "\\end{align*}\n",
    "$$\n",
    "```\n",
    "\n",
    "$$\\begin{align*}\n",
    "  &\\frac{dS}{dt}=-\\frac{\\beta SI}{N}\\\\\n",
    "  &\\frac{dI}{dt}=\\frac{\\beta SI}{N}-\\gamma \\\\\n",
    "  &\\frac{dR}{dt}=\\frac{\\gamma}{I} \n",
    "\\end{align*}\n",
    "$$\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2．上下标\n",
    "\n",
    "^表示上标, _表示下标。如果上下标的内容多于一个字符，要用{}把这些内容括起来当成一个整体。上下标是可以嵌套的，也可以同时使用。\n",
    "\n",
    "例如：\n",
    "```\n",
    "$x^{y^z}=(1+{\\rm e}^x)^{-2xy^w}$\n",
    "```\n",
    "显示:\n",
    "\n",
    "$x^{y^z}=(1+{\\rm e}^x)^{-2xy^w}$\n",
    "\n",
    "另外，如果要在左右两边都有上下标，可以用\\sideset命令。\n",
    "\n",
    "例如：\n",
    "```\n",
    "$\\sideset{^1_2}{^3_4}\\bigotimes$\n",
    "```\n",
    "显示：\n",
    "\n",
    "$\\sideset{^1_2}{^3_4}\\bigotimes$  \n",
    "\n",
    "## 3．括号和分隔符\n",
    "\n",
    "()、[]和|表示自己，`\\{\\}`表示{}。当要显示大号的括号或分隔符时，要用\\left和\\right命令。\n",
    "\n",
    "例如：\n",
    "```\n",
    "$f(x,y,z) = 3y^2z \\left( 3+\\frac{7x+5}{1+y^2} \\right)$\n",
    "```\n",
    "\n",
    "显示：\n",
    "\n",
    "$f(x,y,z) = 3y^2z \\left( 3+\\frac{7x+5}{1+y^2} \\right)$\n",
    "\n",
    "有时,需要 \\left. 或 \\right. 进行匹配而不显示本身。\n",
    "\n",
    "例如：\n",
    "```\n",
    "$\\left.  \\frac{{\\rm d}u}{{\\rm d}x} \\right| _{x=0}$\n",
    "```\n",
    "\n",
    "显示：\n",
    "$\\left.  \\frac{{\\rm d}u}{{\\rm d}x} \\right| _{x=0}$\n",
    "\n",
    "## 4．分数\n",
    "\n",
    "例如：\n",
    "\n",
    "```$\\frac{1}{3}$```   显示：$\\frac{1}{3}$\n",
    "\n",
    "\n",
    "```$1 \\over 3$```     显示：   $1 \\over 3$\n",
    "\n",
    "## 5． 开方 Roots\n",
    "\n",
    "例如：\n",
    "```\n",
    "$\\sqrt{2}$\n",
    "\n",
    "$\\sqrt[n]{3}$\n",
    "```\n",
    "\n",
    "显示：\n",
    "\n",
    "$\\sqrt{2}$\n",
    "\n",
    "$\\sqrt[n]{3}$\n",
    "\n",
    "## 6．省略号\n",
    "\n",
    "数学公式中常见的省略号有两种:\n",
    "\n",
    " \\ldots 表示与文本底线对齐的省略号;\n",
    "\n",
    " \\cdots 表示与文本中线对齐的省略号。\n",
    "\n",
    "例如：\n",
    "```\n",
    "$f(x_1,x_2,\\ldots,x_n) = x_1^2 + x_2^2 + \\cdots + x_n^2$\n",
    "\n",
    "```\n",
    "显示：\n",
    "\n",
    "$f(x_1,x_2,\\ldots,x_n) = x_1^2 + x_2^2 + \\cdots + x_n^2$\n",
    "\n",
    "## 7．矢量\n",
    "\n",
    "例如：\n",
    "```\n",
    "$\\vec{a} \\cdot \\vec{b}=0$\n",
    "```\n",
    "显示：\n",
    "\n",
    "$\\vec{a} \\cdot \\vec{b}=0$\n",
    "\n",
    "## 8．积分 integrals\n",
    "\n",
    "例如：\n",
    "```\n",
    "$\\int_0^1 x^2 {\\rm d}x$\n",
    "```\n",
    "显示：\n",
    "\n",
    "$\\int_0^1 x^2 {\\rm d}x$\n",
    "\n",
    "## 9．极限运算\n",
    "\n",
    "例如：\n",
    "```\n",
    "$\\lim_{n \\rightarrow +\\infty} \\frac{1}{n(n+1)}$\n",
    "```\n",
    "\n",
    "显示：\n",
    "\n",
    "$\\lim_{n \\rightarrow +\\infty} \\frac{1}{n(n+1)}$\n",
    "\n",
    "## 10．累加、累乘运算\n",
    "\n",
    "例如：\n",
    "```\n",
    "$\\sum_{i=0}^n \\frac{1}{i^2}　和　\\prod_{i=0}^n \\frac{1}{i^2}$\n",
    "```\n",
    "显示：\n",
    "\n",
    "$\\sum_{i=0}^n \\frac{1}{i^2}　和　\\prod_{i=0}^n \\frac{1}{i^2}$\n",
    "\n",
    "## 11．希腊字母 Greek letters\n",
    "\n",
    "例如：\n",
    "```\n",
    " \\alpha　\\beta　\\gamma　\\Gamma　\\delta　\\Delta　\\epsilon　\n",
    " \\varepsilon　　\\zeta　\\eta　\\theta　\\Theta　\\vartheta\n",
    " \\iota　\\kappa　\\lambda　\\Lambda　\\mu　\\nu　\n",
    " \\xi　\\Xi　\\pi　\\Pi　\\varpi　\\rho　\n",
    " \\varrho　\\sigma　\\Sigma　\\varsigma　\\tau　\\upsilon　\\Upsilon\n",
    " \\phi　\\Phi　\\varphi　　\\chi　X　\\psi　\\Psi　\\omega　\\Omega\n",
    "```\n",
    "\n",
    "显示：\n",
    "\n",
    "$\\alpha　\\beta　\\gamma　\\Gamma　\\delta　\\Delta　\\epsilon$\n",
    "\n",
    "$\\varepsilon　\\zeta　\\eta　\\theta　\\Theta　\\vartheta$\n",
    "\n",
    "$\\iota　\\kappa　\\lambda　\\Lambda　\\mu　\\nu$\n",
    "\n",
    "$\\xi　\\Xi　\\pi　\\Pi　\\varpi　　\\rho$\n",
    "\n",
    "$\\varrho　\\sigma　\\Sigma　\\varsigma　\\tau　\\upsilon　\\Upsilon$\n",
    "\n",
    "$\\phi　\\Phi　\\varphi　\\chi　\\psi　\\Psi　\\omega　\\Omega$\n",
    "\n",
    "## 12．其它特殊字符\n",
    "\n",
    "#### 关系运算符 Relation Symbols：\n",
    "\n",
    "```$\\pm$```  $\\pm$\n",
    "\n",
    "```$\\times$``` $\\times$\n",
    "\n",
    "```$\\div$```  $\\div$\n",
    "\n",
    "```$\\mid$```  $\\mid$\n",
    "\n",
    "```$\\nmid$```  $\\nmid$\n",
    "\n",
    "```$\\cdot$```  $\\cdot$\n",
    "\n",
    "```$\\circ$```  $\\circ$\n",
    "\n",
    "```$\\ast$```  $\\ast$\n",
    "\n",
    "```$\\bigodot$```  $\\bigodot$\n",
    "\n",
    "```$\\bigoplus$```  $\\bigoplus$\n",
    "\n",
    "```$\\leq$```  $\\leq$\n",
    "\n",
    "```$\\geq$```  $\\geq$\n",
    "\n",
    "```$\\neq$```  $\\neq$\n",
    "\n",
    "```$\\approx$```  $\\approx$\n",
    "\n",
    "```$\\equiv$```  $\\equiv$\n",
    "\n",
    "```$\\sum$```  $\\sum$\n",
    "\n",
    "```$\\prod$```  $\\prod$\n",
    "\n",
    "```$\\coprod$```  $\\coprod$\n",
    "\n",
    "#### 集合运算符 Set Notation\n",
    "\n",
    "```$\\emptyset$```  $\\emptyset$\n",
    "\n",
    "```$\\in$```  $\\in$\n",
    "\n",
    "```$\\notin$```  $\\notin$\n",
    "\n",
    "```$\\subset$```  $\\subset$\n",
    "\n",
    "```$\\supset$```  $\\supset$\n",
    "\n",
    "```$\\subseteq$```  $\\subseteq$\n",
    "\n",
    "```$\\supseteq$```  $\\supseteq$\n",
    "\n",
    "```$\\bigcap$```  $\\bigcap$\n",
    "\n",
    "```$\\bigcup$```  $\\bigcup$\n",
    "\n",
    "```$\\bigvee$```  $\\bigvee$\n",
    "\n",
    "```$\\bigwedge$```  $\\bigwedge$\n",
    "\n",
    "```$\\biguplus$```  $\\biguplus$\n",
    "\n",
    "```$\\bigsqcup$```  $\\bigsqcup$\n",
    "\n",
    "#### 对数运算符：\n",
    "\n",
    "```$\\log$```  $\\log$\n",
    "\n",
    "```$\\lg$```  $\\lg$\n",
    "\n",
    "```$\\ln$```  $\\ln$\n",
    "\n",
    "#### 三角运算符：\n",
    "\n",
    "```$\\bot$```  $\\bot$\n",
    "\n",
    "```$\\angle$```  $\\angle$\n",
    "\n",
    "```$30^\\circ$```  $30^\\circ$\n",
    "\n",
    "```$\\sin$```  $\\sin$\n",
    "\n",
    "```$\\cos$```  $\\cos$\n",
    "\n",
    "```$\\tan$```  $\\tan$\n",
    "\n",
    "```$\\cot$```  $\\cot$\n",
    "\n",
    "```$\\sec$```  $\\sec$\n",
    "\n",
    "```$\\csc$```  $\\csc$\n",
    "\n",
    "#### 微积分运算符：\n",
    "\n",
    "```$\\prime$```  $\\prime$\n",
    "\n",
    "```$\\int$```  $\\int$\n",
    "\n",
    "```$\\iint$```  $\\iint$    \n",
    "\n",
    "```$\\iiint$```  $\\iiint$\n",
    "\n",
    "```$\\iiiint$```  $\\iiiint$\n",
    "\n",
    "```$\\oint$```  $\\oint$\n",
    "\n",
    "```$\\lim$```  $\\lim$\n",
    "\n",
    "```$\\infty$```  $\\infty$\n",
    "\n",
    "```$\\nabla$```  $\\nabla$\n",
    "\n",
    "#### 逻辑运算符：\n",
    "\n",
    "```$\\because$```  $\\because$\n",
    "\n",
    "```$\\therefore$```  $\\therefore$\n",
    "\n",
    "```$\\forall$```  $\\forall$\n",
    "\n",
    "```$\\exists$```  $\\exists$\n",
    "\n",
    "```$\\not=$```  $\\not=$\n",
    "\n",
    "```$\\not>$```  $\\not>$\n",
    "\n",
    "```$\\not\\subset>$```  $\\not\\subset$\n",
    "\n",
    "#### 戴帽符号：\n",
    "\n",
    "```$\\hat{y}$```  $\\hat{y}$\n",
    "\n",
    "```$\\check{y}$```  $\\check{y}$\n",
    "\n",
    "```$\\breve{y}$```  $\\breve{y}$\n",
    "\n",
    "```$\\dot{y}$```  $\\dot{y}$\n",
    "\n",
    "#### 连线符号：\n",
    "\n",
    "```$\\overline{a+b+c+d}$```  $\\overline{a+b+c+d}$\n",
    "\n",
    "```$\\underline{a+b+c+d}$```  $\\underline{a+b+c+d}$\n",
    "\n",
    "```$\\overbrace{a+\\underbrace{b+c}_{1.0}+d}^{2.0}$```     $\\overbrace{a+\\underbrace{b+c}_{1.0}+d}^{2.0}$\n",
    "\n",
    "#### 箭头符号：\n",
    "\n",
    "```$\\uparrow$```  $\\uparrow$\n",
    "\n",
    "```$\\downarrow$```  $\\downarrow$\n",
    "\n",
    "```$\\Uparrow$```  $\\Uparrow$\n",
    "\n",
    "```$\\Downarrow$```  $\\Downarrow$\n",
    "\n",
    "```$\\rightarrow$```  $\\rightarrow$\n",
    "\n",
    "```$\\leftarrow$```  $\\leftarrow$\n",
    "\n",
    "```$\\Rightarrow$```  $\\Rightarrow$\n",
    "\n",
    "```$\\Leftarrow$```  $\\Leftarrow$\n",
    "\n",
    "```$\\longrightarrow$```  $\\longrightarrow$\n",
    "\n",
    "```$\\longleftarrow$```  $\\longleftarrow$\n",
    "\n",
    "```$\\Longrightarrow$```  $\\Longrightarrow$\n",
    "\n",
    "```$\\Longleftarrow$```  $\\Longleftarrow$\n",
    "\n",
    "#### 输出字符\n",
    "\n",
    "空格　#　$　%　&　_　{　}　\n",
    "\n",
    "用命令：　\n",
    "\n",
    "```  ```   空  格\n",
    "\n",
    "```$\\#```   $\\#$\n",
    "\n",
    "```$\\$$```   $\\$$\n",
    "\n",
    "```$\\%$```   $\\%$\n",
    "\n",
    "```$\\&$```   $\\&$\n",
    "\n",
    "```$\\_$```   $\\_$\n",
    "\n",
    "```$\\{$```   $\\{$\n",
    "\n",
    "```$\\}$```  $\\}$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 13．字体转换\n",
    "\n",
    "要对公式的某一部分字符进行字体转换，可以用```{\\rm ```需转换的部分字符}命令，其中,```\\rm```可以参照下表选择合适的字体。一般情况下，公式默认为意大利体。\n",
    "\n",
    "罗马体: ```$\\rm ABC$```  $\\rm ABC$\n",
    "\n",
    "意大利体: ```$\\it ABC$```  $\\it ABC$\n",
    "\n",
    "黑体: ```$\\bf 123$```  $\\bf 123$\n",
    "\n",
    "花体: ```$\\cal ABC$```  $\\cal ABC$\n",
    "\n",
    "等线体: ```$\\sf ABC$```  $\\sf ABC$\n",
    "\n",
    "数学斜体: ```$\\mit ABC$```  $\\mit ABC$\n",
    "\n",
    "打字机字体: ```$\\tt ABC$```  $\\tt ABC$　\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 14. 表格\n",
    "\n",
    "使用```$$\\begin{array}{col style…\\end{array}$$```这样的形式来创建表格.\n",
    "                     \n",
    "* 列样式： \n",
    " \n",
    "  * c： 居中\n",
    "  * l ：左对齐\n",
    "  * r : 右对齐\n",
    "\n",
    "* \\hline: 在本行前加入一条直线\n",
    "\n",
    "* | :表示一条竖线\n",
    "\n",
    "* 表格中各行分隔: \\\\\n",
    "\n",
    "* 表格中各列分隔: & \n",
    "\n",
    "```\n",
    "$$\n",
    "\\begin{array}{c|lcr}\n",
    "n & \\text{Left} & \\text{Center} & \\text{Right} \\\\\n",
    "\\hline\n",
    "1 & 0.24 & 1 & 125 \\\\\n",
    "2 & -1 & 189 & -8 \\\\\n",
    "3 & -20 & 2000 & 1+10i \\\\\n",
    "\\end{array}\n",
    "$$\n",
    "```\n",
    "$$\n",
    "\\begin{array}{c|lcr}\n",
    "n & \\text{Left} & \\text{Center} & \\text{Right} \\\\\n",
    "\\hline\n",
    "1 & 0.24 & 1 & 125 \\\\\n",
    "2 & -1 & 189 & -8 \\\\\n",
    "3 & -20 & 2000 & 1+10i \\\\\n",
    "\\end{array}\n",
    "$$\n",
    "```\n",
    "$$\n",
    "% outer vertical array of arrays\n",
    "\\begin{array}{c}\n",
    "% inner horizontal array of arrays\n",
    "\\begin{array}{cc}\n",
    "% inner array of minimum values\n",
    "\\begin{array}{c|cccc}\n",
    "\\text{min} & 0 & 1 & 2 & 3\\\\\n",
    "\\hline\n",
    "0 & 0 & 0 & 0 & 0\\\\\n",
    "1 & 0 & 1 & 1 & 1\\\\\n",
    "2 & 0 & 1 & 2 & 2\\\\\n",
    "3 & 0 & 1 & 2 & 3\n",
    "\\end{array}\n",
    "&\n",
    "% inner array of maximum values\n",
    "\\begin{array}{c|cccc}\n",
    "\\text{max}&0&1&2&3\\\\\n",
    "\\hline\n",
    "0 & 0 & 1 & 2 & 3\\\\\n",
    "1 & 1 & 1 & 2 & 3\\\\\n",
    "2 & 2 & 2 & 2 & 3\\\\\n",
    "3 & 3 & 3 & 3 & 3\n",
    "\\end{array}\n",
    "\\end{array}\n",
    "\\\\\n",
    "% inner array of delta values\n",
    "\\begin{array}{c|cccc}\n",
    "\\Delta&0&1&2&3\\\\\n",
    "\\hline\n",
    "0 & 0 & 1 & 2 & 3\\\\\n",
    "1 & 1 & 0 & 1 & 2\\\\\n",
    "2 & 2 & 1 & 0 & 1\\\\\n",
    "3 & 3 & 2 & 1 & 0\n",
    "\\end{array}\n",
    "\\end{array}\n",
    "$$\n",
    "```\n",
    "$$\n",
    "% outer vertical array of arrays\n",
    "\\begin{array}{c}\n",
    "% inner horizontal array of arrays\n",
    "\\begin{array}{cc}\n",
    "% inner array of minimum values\n",
    "\\begin{array}{c|cccc}\n",
    "\\text{min} & 0 & 1 & 2 & 3\\\\\n",
    "\\hline\n",
    "0 & 0 & 0 & 0 & 0\\\\\n",
    "1 & 0 & 1 & 1 & 1\\\\\n",
    "2 & 0 & 1 & 2 & 2\\\\\n",
    "3 & 0 & 1 & 2 & 3\n",
    "\\end{array}\n",
    "&\n",
    "% inner array of maximum values\n",
    "\\begin{array}{c|cccc}\n",
    "\\text{max}&0&1&2&3\\\\\n",
    "\\hline\n",
    "0 & 0 & 1 & 2 & 3\\\\\n",
    "1 & 1 & 1 & 2 & 3\\\\\n",
    "2 & 2 & 2 & 2 & 3\\\\\n",
    "3 & 3 & 3 & 3 & 3\n",
    "\\end{array}\n",
    "\\end{array}\n",
    "\\\\\n",
    "% inner array of delta values\n",
    "\\begin{array}{c|cccc}\n",
    "\\Delta&0&1&2&3\\\\\n",
    "\\hline\n",
    "0 & 0 & 1 & 2 & 3\\\\\n",
    "1 & 1 & 0 & 1 & 2\\\\\n",
    "2 & 2 & 1 & 0 & 1\\\\\n",
    "3 & 3 & 2 & 1 & 0\n",
    "\\end{array}\n",
    "\\end{array}\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 15. 矩阵\n",
    "\n",
    "使用 ```$$\\begin{matrix}…\\end{matrix}$$```这样的形式来表示矩阵，在```\\begin```与```\\end```之间加入矩阵中的元素即可。\n",
    "\n",
    "* 行之间分隔: ``\\\\``\n",
    "* 列之间分隔: ```&```\n",
    "\n",
    "```\n",
    "$$ At=b \\tag{3}$$\n",
    "\n",
    "$$ \n",
    "\\left[\n",
    "    \\begin{matrix}\n",
    "      4 & -1 & -1 & 0 \\\\\n",
    "      -1 & 4 & 0 & -1 \\\\\n",
    "      -1 & 0 & 4 & -1 \\\\\n",
    "       0 & -1 & -1 & 4 \n",
    "    \\end{matrix}\n",
    "\\right] \n",
    "\\left[\n",
    "    \\begin{matrix}\n",
    "       node[1,1] \\\\\n",
    "       node[1,2] \\\\\n",
    "       node[2,1] \\\\\n",
    "       node[2,2] \n",
    "    \\end{matrix}\n",
    "\\right]\n",
    "=\n",
    "\\left[\n",
    "    \\begin{matrix}\n",
    "       node[0,1]+node[1,0] \\\\\n",
    "       node[0,2]+node[1,3] \\\\\n",
    "       node[2,0]+node[3,1] \\\\\n",
    "       node[2,3]+node[3,2] \n",
    "    \\end{matrix}\n",
    "\\right]\n",
    "\\tag{4}\n",
    "$$\n",
    "```\n",
    "$$ At=b \\tag{3}$$\n",
    "\n",
    "$$ \n",
    "\\left[\n",
    "    \\begin{matrix}\n",
    "      4 & -1 & -1 & 0 \\\\\n",
    "      -1 & 4 & 0 & -1 \\\\\n",
    "      -1 & 0 & 4 & -1 \\\\\n",
    "       0 & -1 & -1 & 4 \n",
    "    \\end{matrix}\n",
    "\\right] \n",
    "\\left[\n",
    "    \\begin{matrix}\n",
    "       node[1,1] \\\\\n",
    "       node[1,2] \\\\\n",
    "       node[2,1] \\\\\n",
    "       node[2,2] \n",
    "    \\end{matrix}\n",
    "\\right]\n",
    "=\n",
    "\\left[\n",
    "    \\begin{matrix}\n",
    "       node[0,1]+node[1,0] \\\\\n",
    "       node[0,2]+node[1,3] \\\\\n",
    "       node[2,0]+node[3,1] \\\\\n",
    "       node[2,3]+node[3,2] \n",
    "    \\end{matrix}\n",
    "\\right]\n",
    "\\tag{4}\n",
    "$$\n",
    "\n",
    "### 增广矩阵\n",
    "\n",
    "增广矩阵需要使用array来实现\n",
    "```\n",
    "$$ \\left[\n",
    "      \\begin{array}{cc|c}\n",
    "        1&2&3\\\\\n",
    "        4&5&6\n",
    "      \\end{array}\n",
    "    \\right]\n",
    "$$\n",
    "```\n",
    "$$ \\left[\n",
    "      \\begin{array}{cc|c}\n",
    "        1&2&3\\\\\n",
    "        4&5&6\n",
    "      \\end{array}\n",
    "    \\right]\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 16. Crossing things out\n",
    "\n",
    "Use `\\require{cancel}` in the first formula in your post that requires cancelling; you need it only once per page. Then use:\n",
    "\n",
    "`$\\require{cancel}$` $\\require{cancel}$\n",
    "\n",
    "y+\\cancel{x}  $y+\\cancel{x}$\n",
    "\n",
    "\\cancel{y+x}   $\\cancel{y+x}$ \n",
    "\n",
    "y+\\bcancel{x}  $y+\\bcancel{x}$\n",
    "\n",
    "y+\\xcancel{x}   $y+\\xcancel{x}$\n",
    "\n",
    "y+\\cancelto{0}{x} $y+\\cancelto{0}{x}$ \n",
    "\n",
    "\n",
    "\\frac{1\\cancel9}{\\cancel95} = \\frac15 $\\frac{1\\cancel9}{\\cancel95} = \\frac15$\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 17 Color\n",
    "\n",
    "The package xcolor, described in Colors, allows us to add color to our equations. For example, \n",
    "\n",
    "    $k = {\\color{red}x} \\mathbin{\\color{blue}-} 2$\n",
    "    \n",
    "    \n",
    " $k = {\\color{red}x} \\mathbin{\\color{blue}-} 2 $  \n",
    " \n",
    "The only problem is that this disrupts the default LaTeX formatting around the `-` operator. To fix this, we enclose it in a `\\mathbin` environment, since `-` is a binary operator"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "\n",
    "## 参考：\n",
    "\n",
    "1. [LaTeX](http://www.latex-project.org/)\n",
    "\n",
    "\n",
    "2. [MathJax](https://www.mathjax.org/)\n",
    "\n",
    "\n",
    "3. [LaTex mathematics for equations: LaTeX/Mathematics](https://en.wikibooks.org/wiki/LaTeX/Mathematics)\n",
    "\n",
    "\n",
    "4. https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference/5044\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.0"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "218.667px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  },
  "widgets": {
   "state": {},
   "version": "1.1.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}